package com.imooc.activiti.event;

import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.engine.delegate.event.ActivitiEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 流程event
 * Creat by zyg
 */
public class JobEventListerer implements ActivitiEventListener {
    private final static Logger LOGGER= LoggerFactory.getLogger(JobEventListerer.class);

    @Override
    public void onEvent(ActivitiEvent activitiEvent) {
        ActivitiEventType eventType=activitiEvent.getType();
        String name=eventType.name();
        if(name.startsWith("TIMER")||name.startsWith("JOB")){
            LOGGER.info("监听到Job事件{} \t {}",eventType,activitiEvent.getProcessInstanceId());
        }
    }

    @Override
    public boolean isFailOnException() {
        return false;
    }
}
